<%@ page language="java" import="java.util.*" contentType="text/html"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta charset="UTF-8"/>
	<script type = "text/javascript" ></script>
	<script src='<c:url value="/js/boot.js"></c:url>'></script>
	<script src='<c:url value="/js/rqfui/rqfui.js"></c:url>'></script>
	<script type="text/javascript"	src='<c:url value="/js/ajaxfileupload.js"></c:url>'></script>
	<title>课程基本信息</title>
	<style>
		html,body{
			margin: 0;
			padding: 0;
			font-family: "微软雅黑";
		}
		li{
			list-style: none;
		}
		a{
			text-decoration: none;
		}
		.Basic_course_content{
			width: 1920px;
			width: 100%;
		}
		.Basic_course_content_content{
			width: 100%;
			margin: 0 auto;
		}
		.Basic_course_content_content_content{
			width: 780px;
			margin: 0 auto;
			margin-top: 30px;
			text-align: left;
		}
		.Basic_course_content_content_content_title{
			color: #2459aa;
			font-size: 18px;
			padding-bottom: 5px;
			border-bottom: 1px solid #2459aa;
		}
		.Basic_course_content_content_content_content{
			padding: 25px 0;
		}
		.Basic_course_content_content_content_content>ul>li{
			padding: 16px 0;
		}
		.Basic_course_content_content_content_content>ul{
			margin: 0;
			padding: 0;
			margin-bottom: 16px;
		}
		.Basic_course_content_content_content_content>ul>li>div>span{
			float: left;
			font-size: 16px;
			padding: 4px 0;
			width: 95px;   /*  */
		}
		.Basic_course_content_content_content_content>ul>li>div>span>font{
			color: #ff0000;
		}
		.Basic_course_content_content_content_content>ul>li>div>input{
			width: 420px;
			padding: 5px 0;
			padding-left: 5px;
		}
		.Basic_course_content_content_content_content>ul>li>div>select{
			padding: 5px 0;
			padding-left: 5px;
		}
		.Basic_course_content_content_content_content>ul>li>div>textarea{
			width: 415px;
			padding: 5px;
    		margin-top: 5px;
    		resize: none; /*  */
		}
		.Basic_course_content_content_content_content>ul>li>div>select>option{
			padding: 3px;
		}
		.Basic_course_baocun{
			background: #2459aa;
			color: #fff;
			font-size: 16px;
			padding: 5px 15px;
			border-radius: 3px;
			margin-left: 92px;
		}
		
		
		
		
		.mini-buttonedit-border {
		    height: 27.78px !important;
		}
		    .mini-buttonedit-input {
		    line-height: 27.78px !important;
		}
		    .mini-buttonedit-input {
		    height: 27.78px  !important;
		}
			.mini-buttonedit-border, .mini-textbox-border {
			    border-radius: 0px !important;
		}
			.mini-buttonedit-icon {
			    margin-top: 7px !important;
		}
			.mini-buttonedit-button {
			    height: 27.78px !important;
		}
			.mini-buttonedit-border {
			    border-color: #a9a9a9 !important; 
		}
			.mini-buttonedit-button {
			    border-left: solid 1px #a9a9a9 !important;
		}
		#lookup a,#lookup2 a{
			line-height:29.1px;
			text-decoration:underline;
		}
	</style>
</head>
<body>
	<div class="Basic_course_content">
		<div class="Basic_course_content_content">
			<div class="Basic_course_content_content_content">
				<div class="Basic_course_content_content_content_title">
					课程基本信息
				</div>
				<div class="Basic_course_content_content_content_content">
					<ul>
						<li>
							<div>
								<span>课程名称：</span>
								<input type="text" id = "class_name" readonly= "true"/>
							</div>
						</li>
						<li>
							<div>
								<span>课程类型：</span>
								<input type="text" id = "select_type"  readonly= "true"/> 
							</div>
						</li>
						<li>
							<div>
								<span> 课程形式：</span>
								<input id="source_type" name="look" readonly= "true"/>
							</div>
						</li>
						
						<li id = "selectSource" style="padding: 0px  ;  margin: 20px 0;">
							<div>
								<span>资料：</span>
								<p id="lookup" name="look" ></p>
							</div> 
							
						</li>
						<li id = "selectPpt" style="padding: 0px;    margin-top: 33px;">
							<div>
								<span>PPT：</span>
								<p id="lookup2" name="look2"  readonly= "true"></p>
							</div> 
							
						</li>
						<li>
							<div>
								<span>课程封面：</span>
								<input id = "class_photo" accept = "image/jpeg,image/jpg,image/png" name = "photo" type="file" style="border: 1px solid #ccc;display:none;" onchange="javascript:setImagePreview();" />
								<div id="localImag" style="width:250px;height:200px;border:1px solid #a9a9a9;display: inline-block;">
									<img id="course_cover" style="width:250px;height:200px;" src="<c:url value='/share/images/anli.png' />" onclick="F_Open_dialog()"/>
								</div>
								
							</div>
						</li>
						<li>
							<div class="Basic_course_modify">
								<span> 课程简介：</span>
								<textarea id = "class_con" rows="8" cols="50" placeholder="请填写课程简介"  readonly= "true"></textarea>
							</div>
						</li>
					</ul>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
	mini.parse();
	mini_debugger = false;
	var rootPath = '${rootPath}';
	var fileServer = '${fileServer}';
	var course_id = '${course_id}';
	var datagrid = mini.get("datagrid");
	var datagrid2 = mini.get("datagrid2");
	var keyText = mini.get("keyText");
	var keyText2 = mini.get("keyText2");
	var filterHelper = gridFilter();
	var filterHelper2 = gridFilter();
	 var lookup = mini.get("lookup");
	 var lookup2 = mini.get("lookup2");
	//source_type值改变显示不同
	var source_type= '${type}';
	
	$(function(){
		getInfo();
	})
	
    //获取数据
    function getInfo(){
    	var url = rootPath + "/class/course_info/" + course_id;
    	$.ajax({
			url:url,
			method:"post",
			dataType:"json",
			data:{},
			success:function(data){
				if(data){
					showData(data);
				}else{
					top.commonTools.showTip("获取数据失败!", 2);
				}
			}
		});
    }
    //展示数据
    function showData(data){
    	$("#class_name").val(data.class_name);
    	$("#select_type").val(data.name);
    	var type;
    	if(data.type == 1){
    		type = "图文课程";
    	}else if(data.type == 2){
    		type ="音频课程";
    	}else{
    		type = "视频课程";
    	}
    	$("#source_type").val(type);
    	$("#lookup").html("<a href=\"javascript:check('"+data.sourceId+"','"+data.type+"')\">"+data.sourceName+"</a>");
    	$("#lookup2").html("<a href=\"javascript:check('"+data.pptId+"','4')\">"+data.pptName+"</a>");
    	$("#class_con").val(data.class_con);
    	var imgSrc=null;
    	if(data.imgPath && data.imgUUID){
			imgSrc = fileServer+data.imgPath+'/'+data.imgUUID;
		}else{
			imgSrc = rootPath+"/share/images/anli.png";
		} 
    	$("#course_cover").attr('src',imgSrc);
    }
    
    function check(attachId,type) {
		var url = rootPath +"/attach/";
		var width = 900;
		var height = 600;
		if(type == 3){
			url += "videoView/" + attachId;
		}else if(type == 2){
			width = 500;
			height=100;
			url += "audioView/" + attachId;
		}else if(type == 4){
			url += "pptView/" + attachId;
		}
		if(attachId == 0&&type != 1){
			mini.alert("未关联附件！");
			return;
		}
		mini.open({
				url : url,
				title : "预览",
				width : width,
				height : height,
				onload : function() {
				},
				ondestroy : function(action) {
				}
		});
	}
	</script>
</body>
</html>
